package com.zmj.sy.mom.srv.aps.controller;

import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseIdReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseIdsReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseListResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.shiftteam.ShiftTeamAddReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.shiftteam.ShiftTeamAllResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.shiftteam.ShiftTeamListResVo;
import com.zmj.sy.mom.srv.aps.service.ShiftTeamService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequiredArgsConstructor
@Api(tags = "班组人员管理")
@RestController
@RequestMapping("/shiftTeam")
public class ShiftTeamController {

    private final ShiftTeamService shiftTeamService;

    @ApiOperation("添加班组人员")
    @PostMapping("/add")
    public BaseResVo add(@RequestBody ShiftTeamAddReqVo reqVo) {
        shiftTeamService.add(reqVo);
        return BaseResVo.ok("添加成功");
    }

    @ApiOperation("删除班组人员")
    @PostMapping("/remove")
    public BaseResVo remove(@RequestBody BaseIdsReqVo reqVo) {
        shiftTeamService.remove(reqVo);
        return BaseResVo.ok("删除成功");
    }

    @ApiOperation("获取班组人员列表")
    @GetMapping("/list")
    public BaseListResVo<ShiftTeamListResVo> list(BaseIdReqVo reqVo) {
        List<ShiftTeamListResVo> shiftTeams = shiftTeamService.list(reqVo);
        return BaseListResVo.of(shiftTeams, ShiftTeamListResVo.class);
    }

    @ApiOperation("获取所有人员")
    @GetMapping("/all")
    public BaseListResVo<ShiftTeamAllResVo> all(BaseIdReqVo reqVo) {
         List<ShiftTeamAllResVo> shiftTeams = shiftTeamService.all(reqVo);
         return BaseListResVo.of(shiftTeams, ShiftTeamAllResVo.class);
    }




}
